/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: hp
 * Date: 2024-02-21
 * Time: 14:07
 */
public class Test {
    public static void move(char pos1,char pos2) {
        System.out.print(pos1+"->"+pos2+" ");
    }
    //pos1 是起始位置
    //pos2 是中转位置
    //pos3 目标位置
    //2
    // A B C
    // A C B
    //A->B
    //A->C
    //B A C
    //B->C
    public static void hanoi(int n,char pos1,char pos2,char pos3) {
        if(n == 1) {
            move(pos1,pos3);
        }
        else {
            hanoi(n-1,pos1,pos3,pos2);//通过c来将n-1移动到b上
            move(pos1,pos3);
            hanoi(n-1,pos2,pos1,pos3);//再通过A来将B上的盘子移动到C上
        }
    }

    public static void main(String[] args) {
        hanoi(1,'A','B','C');
        System.out.println();
        hanoi(2,'A','B','C');
        System.out.println();
        hanoi(3,'A','B','C');
    }
 /*   public static int fun5(int n) {
        if(n >= 1 || n <= 2) {
            return n;
        }
        return fun5(n -1) + fun5(n -2);
    }

    public static void main(String[] args) {
        System.out.println(fun5(5));
    }*/
  /*  public static int fun4(int n) {
        if(n >= 0 && n < 10) {
            return n;
        }
        return (n % 10) + fun4(n / 10);
    }
    public static void main(String[] args) {
        System.out.println(fun4(123));
    }*/


  /*  public static void fun3(int n) {
        if(n => 0 && n < 10) {
            System.out.print(n+" ");;
        }
        else {
            fun3(n / 10);
            System.out.print(n % 10+" ");
        }
    }


    public static void main(String[] args) {
        fun3(1234);
    }*/

   /* public static int add(int x,int y) {
        return x + y;
    }
    public static double add(double x,double y,double z) {
        return x + y + z;
    }
    public static void main(String[] args) {
        System.out.println(add(3,4));
        System.out.println(add(1.1,2.2,3.3));
    }*/

   /*public static int fun1(int n) {
       if(n == 1) {
           return 1;
       }
       return n*fun1(n-1);
   }
    public static void main(String[] args) {
       int ret = fun1(5);
        System.out.println(ret);
    }*/

   /* public  static int max(int x, int y) {
        if(x > y) {
            return x;
        }
        else {
            return y;
        }
    }
    public static double max(double x,double y,double z) {
        if(x > y) {
            if(x > z) {
                return x;
            }
            else {
                return z;
            }
        }
        else if(x < y){
            if(y > z) {
                return y;
            }
            else {
                return z;
            }
        }
        else if(x > z) {
            if(x > y) {
                return x;
            }
            else {
                return y;
            }
        }
        else if(x < z) {
            if(z > y) {
                return z;
            }
            else {
                return y;
            }
        }
       else if(y > z) {
            if(y > x) {
                return y;
            }
            else {
                return x;
            }
        }

       else if(y < z){
           if(z > x) {
               return z;
           }
       }
        return x;
    }
    public static void main(String[] args) {
        int max1 = max(3,4);
        System.out.println(max1);
        double max2=max(11.2,4.1,6.3);
        System.out.println(max2);
    }*/


}
